![]() |
RGetResource |
||||
Header: | Resources.h | Carbon status: | Unsupported | |
Gets resource data for a resource and includes ROM-resident system resources in the Resource Manager’s search of resource maps.
Handle RGetResource ( ResType theType, SInt16 theID );
The resource type of the resource about which you wish to retrieve data.
An integer that uniquely identifies the resource about which you wish to retrieve data.
If the function finds the specified resource entry in one of the resource maps and the entry contains a valid handle, it returns that handle. If the entry contains a handle whose value is NULL, and if you haven’t called the SetResLoad function with the load parameter set to FALSE, RGetResource attempts to read the resource into memory. If it can’t find the resource data, the function returns NULL, and the ResError function returns the result code resNotFound. The RGetResource function also returns NULL if the resource data to be read into memory won’t fit, in which case ResError returns an appropriate Memory Manager result code. If you call RGetResource with a resource type that can’t be found in any of the resource maps of the open resource forks, the function returns NULL, but ResError returns the result code noErr. You should always check that the value of the returned handle is not NULL.
The function searches the resource maps in memory for the specified resource. The resource maps in memory, which represent all open resource forks, are arranged as a linked list. The RGetResource function first uses the GetResource function to search this list. The GetResource function starts with the current resource file and progresses through the list in order (that is, in reverse chronological order in which the resource forks were opened) until it finds the resource’s entry in one of the resource maps. If GetResource doesn’t find the specified resource in its search of the resource maps of open resource forks (which includes the System file’s resource fork), RGetResource sets the global variable RomMapInsert to TRUE, then calls GetResource again. In response, GetResource performs the same search, but this time it looks in the resource map of the ROM-resident resources before searching the resource map of the System file.
This function may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.
Not supported in Carbon. Not available in Carbon.
There will be no ROM in Mac OS X, so this ROM-related function will not be supported.
© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)